import { asyncUniAPIWrap, uniAPIWrap } from "@/utils/apiWrap";
import type { UniApiParam } from "@/typings/apiCallBack";
class Feedback {
    _hasLoading: boolean = false;
    _hasToast: boolean = false;
    showLoading(opt: UniApiParam) {
        this._hideOthers();
        this._hasLoading = true;
        asyncUniAPIWrap("showLoading", opt);
    }
    hideLoading() {
        this._hasLoading = false;
        uniAPIWrap("hideLoading");
    }
    showToast(options: UniApiParam) {
        this._hideOthers();
        this._hasToast = true;
        asyncUniAPIWrap("showToast", options);
    }
    hideToast() {
        this._hasToast = false;
        uniAPIWrap("hideToast");
    }
    _hideOthers() {
        if (this._hasLoading) {
            this.hideLoading();
        }
        if (this._hasToast) {
            this.hideToast();
        }
    }
}

const feedback = new Feedback();
export { feedback };
